package edu.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import edu.core.StringUtil;
import edu.dao.BaseDao;
import edu.entity.Module;
import edu.entity.Notice;

@Service("noticeService")
public class NoticeService extends BaseService {
	@Autowired
	private BaseDao baseDao;
	
    public void insertNotice(Notice notice) throws Exception {
    	if(notice!=null){
    		baseDao.insert(notice);
    	}
    }
    
    public void updatetNotice(Notice notice) throws Exception {
    	if(notice!=null){
    		baseDao.update(notice);
    	}
    }
    
    public void deleteNotice(Notice notice) throws Exception {
    	if(notice!=null){
    		baseDao.delete(notice);
    	}
    }
    
    public void deleteNoticeById(String id) throws Exception {
    	if(StringUtil.isNotEmpty(id)){
    		baseDao.deleteById(Notice.class, id);
    	}
    }
    
    public Notice selectNoticeById(String id) throws Exception {
    	Notice notice = null;
    	if(StringUtil.isNotEmpty(id)){
    		notice = (Notice)baseDao.selectObjById(Notice.class, id);
    	}
    	return notice;
    }
}
